package com.example.demo.demos.web.mapper;

import com.example.demo.demos.web.entity.Car;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CarMapper {
    @Select("select * from car JOIN pinpai on car.ppid = pinpai.id where carname like concat('%',#{carname},'%') limit #{pageNum},#{pageSize}")
    List<Car> selectcar(@Param("carname") String carname, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
@Select("select count(*) from car JOIN pinpai on car.ppid =pinpai.id where carname like concat('%',#{carname},'%')")
    Integer totalcar(@Param("carname") String carname);
@Insert("insert into car (carname,ppid,carimg,cph,status,zj) VALUES (#{carname},#{ppid},#{carimg},#{cph},#{status},#{zj})")
    Integer addcar(Car car);
@Update("update car set carname=#{carname},ppid=#{ppid},carimg=#{carimg},cph=#{cph},status=#{status},zj=#{zj} where id=#{id}")
    Integer updatecar(Car car);
@Select("select * from car JOIN pinpai on car.ppid = pinpai.id where ppid like concat ('%',#{ppid},'%')")
    List<Car> selectbyid(@Param("ppid") String ppid);
@Update("update  car set status = 1 where id=#{id}")
    Integer updatestatus(@Param("id") String id);
    @Update("update  car set status = 0 where id=#{id}")
    Integer updatestatus1(@Param("id") String id);
}
